package com.thingsgrid.appmanager.service.impl;

import com.alibaba.fastjson.JSON;
import com.thingsgrid.appmanager.service.MqttSendService;
import com.thingsgrid.mqtthelper.feign.MqttHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 功能说明：mqtt消息发送实现类
 *
 * @author 李龙飞
 * @since 2019/8/28 17:50
 */

@Service
public class MqttSendServiceImpl implements MqttSendService {

	@Autowired(required = false)
	private MqttHelper mqttHelper;

	/**
	 *说明：消息发送
	 *@author lilongfei
	 *@since 2019/8/28 17:55
	 */
	@Override
	public void sendMsg(Map<String, String> sendContent, String topic) {
		String jsonContent = JSON.toJSONString(sendContent);
		mqttHelper.sendMsg(topic,jsonContent);
	}
}
